#include <gtest/gtest.h>
#include <string>

#include "address-book.h"
#include "person.h"

/* Ex 4.2: Test to see that copy does not share state with the
           original - expected to fail.
*/
TEST(AddressBookEntry, copyDoesNotShareStateWithOriginal)
{
    Person john("john", 20);
    AddressBookEntry entry1(john,"john_pic" );
    AddressBookEntry entry2 = entry1;

    entry2.setImageName("entry2_pic");

    EXPECT_FALSE( entry1 == entry2 );
}

/* Ex 4.3: Test to see that an object is independent from the object
           it is assigned from after assigning - expected to fail.
*/
TEST(AddressBookEntry, assignedObjectIndependentFromAssignee)
{
    Person john("john", 21);
    Person jane("jane", 26);
    AddressBookEntry entry1( john,"john_pic" );
    AddressBookEntry entry2( jane,"jane_pic");

    entry1 = entry2;

    entry2.setImageName("new_pic");

    EXPECT_FALSE( entry1 == entry2 );

}
